<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of AdminController
 *
 * @author Tartharia
 */
class AdminController extends Controller{
    public function init() {
        parent::init();
        $this->layout = 'column2';
    }
    protected function beforeAction()
    {
        if(!Yii::app()->user->checkAccess('moderator'))
            throw new CHttpException(403,'Доступ запрещен');
        
        return TRUE;
    }

    public function actions()
    {
		return array(
			// captcha action renders the CAPTCHA image displayed on the contact page
			'captcha'=>array(
				'class'=>'CCaptchaAction',
				'backColor'=>0xFFFFFF,
			)
		);
    }
    
    public function actionIndex()
    {
        $this->render('index');
    }
    
    public function actionUsers()
    {
        $criteria=new CDbCriteria();
        $count = User::model()->count($criteria);
        
        $pages = new CPagination($count);      
        $pages->pageSize = 1;
        $pages->applyLimit($criteria);
        
        $users = User::model()->findAll($criteria);
        $this->render('userslist',array('users' => $users, 'pages' => $pages));
    }
        
}

?>
